import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');

@Define.Table({ TableName: 'unit' })
export class Unit extends EntityObjectType<Unit> {
    @Define.PrimaryKey()
    id: string;

    @Define.Column({ DataType: Define.DataType.VARCHAR })
    name: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        DefaultValue: 'normal'
    })
    type: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        IsIndex: true
    })
    storeId: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    version: number;
}

export const UnitType = {
    Normal: 'normal',
    Weight: 'weight'
}